package com.gs.cd.service.auth.eum;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 资源分类
 * 弃用。
 *
 * @see com.gs.cd.eum.CategoryEnum 替换之
 */
@Deprecated
public enum ResourceCategoryEnum {
    SYSTEM("system"), PROJECT("project"), TENANT("tenant");

    @EnumValue
    private final String name;


    ResourceCategoryEnum(String name) {
        this.name = name;
    }

    @JsonValue
    public String getName() {
        return name;
    }

    @JsonCreator
    public static ResourceCategoryEnum fromName(String name) {

        for (ResourceCategoryEnum value : ResourceCategoryEnum.values()) {
            if (value.getName().equals(name)) return value;
        }

        return ResourceCategoryEnum.TENANT;
    }
}
